package fgl.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * @author fuguangli
 * @description 前沿类
 * @Create date:    2017/7/5
 */
@Configuration
public class RedisConfig {
    private static String redisHost = "10.0.1.47";
    private static Integer redisPort = 6379;

    @Bean
    public static JedisPoolConfig jedisPoolConfig() {
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxIdle(300);
        config.setMaxTotal(60000);
        config.setTestOnBorrow(true);
        return config;
    }

    @Bean
    public static JedisPool jedisPool(JedisPoolConfig jedisPoolConfig) {
        JedisPool pool = new JedisPool(jedisPoolConfig, redisHost, redisPort);
        return pool;
    }
}
